#ifndef WIFISCANNER_H
#define WIFISCANNER_H

#include <QObject>
#include <QStringList>

class WiFiScanner : public QObject {
    Q_OBJECT
    Q_PROPERTY(QStringList wifiList READ wifiList NOTIFY wifiListChanged)
    Q_PROPERTY(QString connectionStatus READ connectionStatus NOTIFY connectionStatusChanged)
    Q_PROPERTY(QString ipAddress READ ipAddress NOTIFY ipAddressChanged)//ip地址

public:
    static  WiFiScanner &getInstance();

    QStringList wifiList();
    QString connectionStatus();
    QString ipAddress(); // 新增函数声明

public slots:
    void scanWiFi();
    void connectToNetwork(const QString &ssid, const QString &password);
    void updateConnectionStatus();

signals:
    void wifiListChanged();
    void connectionStatusChanged();
    void clearConnectionStatus();
    void connectionResult(bool success, const QString &ssid); // 添加SSID参数
    void ipAddressChanged(); // 新增信号

private:
    explicit WiFiScanner(QObject *parent = nullptr);
    QStringList m_wifiList;
    QString m_connectionStatus;
    QString m_ipAddress =""; // 新增成员变量

    void updateIpAddress(); // 新增函数声明
};

#endif // WIFISCANNER_H
